#include<iostream>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
int dirx[8] = { -2,-1,1,2,2,1,-1,-2 };
int diry[8] = { 1,2,2,1,-1,-2,-2,-1 };
int n, m, x, y, step = 1;
int arr_ans[500][500];
bool arr_rem[500][500];
int main()
{
	queue<pair<int, int>> que;
	cin >> n >> m >> x >> y;
	que.push(make_pair(x, y));
	arr_rem[x][y] = true;
	while (!que.empty()) {
		x = que.front().first; y = que.front().second; que.pop();
		for (int i = 0; i < 8; i++) {
			int xx = x + dirx[i], yy = y + diry[i];
			if (xx<1 || yy<1 || xx>n || yy>m || arr_rem[xx][yy])continue;
			que.push(make_pair(xx, yy));
			arr_ans[xx][yy] = arr_ans[x][y] + 1;
			arr_rem[xx][yy] = true;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (arr_rem[i][j])cout << arr_ans[i][j] << " ";
			else cout << -1 << " ";
		}
		cout << endl;
	}
	return 0;
}